<div class="container contents bgw">
	<div class="col-sm-8 col-sm-offset-2 menberadd">
		<div class="col-sm-2" ng-repeat="menbers in view.menber" >
			<div class="menshow text-center" >
				<a ng-bind="menbers.title||menbers.grade" tooltips title="点击修改升级规则" tooltip-side="top" tooltip-size="small" ng-click="showFn(menbers.grade)"  ng-Mouseleave="menbers.title=menbers.grade" ng-Mouseover="menbers.title='修改'" style="z-index:3"></a>
				<button class="btn btn-default" tooltips title="点击修改级别名称" tooltip-side="bottom" tooltip-size="small" ng-click="updateFn(menbers.grade)">{{menbers.name}}
				</button>
				<img src="public/img/arrow.png" ng-show="($index+1)<view.maxGrades" style="position:relative; top:-65px;left:40px;">
				</img>
			</div >
		</div>
		<div class="col-sm-2 menadd" ng-if="view.menber.length<view.maxGrades" >
			<a ng-click="addnewFn()"> <i class="glyphicon glyphicon-plus"></i>
			</a>
		</div>
	</div>
	<div class="col-sm-8 tables col-sm-offset-2 mt20 text-left">
		<div class="list-group" ng-if="plan.add">
			<div class="list-group-item default">
				<h4  class="left-title" ng-bind="(view.show.name)+'会员升级规则'"></h4>
				<h4 class="right-title" style="padding:0 20px;"> <i class="glyphicon glyphicon-remove" ng-click="closeFn('add')"></i>
				</h4>
			</div>
			<div class="list-group-item">
				<form class="form-horizontal" ng-submit="postSend()" class="mt40" name="add_form">
					<div class="form-group mt20">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-6 text-red text-left">*为必填项</div>
					</div>
					<div class="out ruleadd" >
						<div class="col-sm-3 text-right">
							<span class="title">名称</span>
						</div>
						<div class="col-sm-8 content mb0">
							<div class="form-control-static col-sm-offset-1 text-left" ng-bind="view.show.name"></div>
						</div>
					</div>
					<div class="out ruleadd" >
						<div class="col-sm-3 text-right ">
							<span class="title">购买</span>
						</div>
						<div class="col-sm-8 content mb0">
							<div class="form-group mb22"  >
								<div class="form-control-static pull-left">
									<span class="text-red">*</span>
									花费
								</div>
								<div class=" col-sm-5">
									<input type="number" min="0" class="form-control" ng-model="posts.BUY.value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red" ng-bind="view.menber[view.show.grade-2].name||'一般顾客'"></span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>

							<div class="form-group mb22" ng-if="view.menber[view.show.grade-1].grade > 1" >
								<div class="form-control-static pull-left">
									<span class="text-red">*</span>
									花费
								</div>
								<div class=" col-sm-5">
									<input type="number" min="0"  class="form-control" ng-model="posts.BUY.special_value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red">一般顾客</span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>
						</div>

					</div>
					<div class="out ruleadd" >
						<div class="col-sm-3 text-right ">
							<span class="title">其他</span>
						</div>
						<div class="col-sm-8  mb0" ng-class="{'content2':view.show.grade-1==0||'content'}">
							<div class="form-group mb22">
								<div class="checkbox  pull-left">
									<label>
										<input type="checkbox" ng-model="check.POINT_EXCHANGE" >积分兑换</label>
								</div>

							</div>
							<div class="form-group mb22" ng-if="check.POINT_EXCHANGE" >
								<div class="form-control-static pull-left">兑换</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.POINT_EXCHANGE.value"/>
								</div>
								<div class="form-control-static pull-left">
									积分，从
									<span class="text-red" ng-bind="view.menber[view.show.grade-2].name||'一般顾客'"></span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>
							<div class="form-group mb22" ng-if="check.POINT_EXCHANGE&&view.menber[view.show.grade-1].grade > 1">
								<div class="form-control-static pull-left">兑换</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.POINT_EXCHANGE.special_value"/>
								</div>
								<div class="form-control-static pull-left">
									积分，从
									<span class="text-red">一般顾客</span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>

							<div class="form-group mb22">
								<div class="checkbox  pull-left">
									<label>
										<input type="checkbox" ng-model="check.POINT" value="option1">累积积分升级</label>
								</div>

							</div>

							<div class="form-group mb22" ng-if="check.POINT">
								<div class="form-control-static pull-left">累积</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.POINT.value"/>
								</div>
								<div class="form-control-static pull-left">
									积分，从
									<span class="text-red">一般顾客</span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>

							<div class="form-group mb22">
								<div class="checkbox  pull-left">
									<label>
										<input type="checkbox" ng-model="check.CHARGE" >充值</label>
								</div>
							</div>
							<div class="form-group mb22"  ng-if="check.CHARGE">
								<div class="form-control-static pull-left">
									充值
								</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.CHARGE.value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red" ng-bind="view.menber[view.show.grade-2].name||'一般顾客'"></span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>
							<div class="form-group mb22"  ng-if="check.CHARGE&&view.menber[view.show.grade-1].grade > 1">
								<div class="form-control-static pull-left">
									充值
								</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.CHARGE.special_value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red" >一般顾客</span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>

							<!-- <div class="form-group mb22">
								<div class="checkbox  pull-left">
									<label>
										<input type="checkbox" ng-model="check.SINGLE_COST" >消费</label>
								</div>

							</div>
							<div class="form-group mb22"  ng-if="check.SINGLE_COST">
								<div class="form-control-static pull-left">
									单次消费满
								</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.SINGLE_COST.value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red" ng-bind="view.menber[view.show.grade-2].name||'一般顾客'"></span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div>
							<div class="form-group mb22"  ng-if="check.SINGLE_COST&&view.menber[view.show.grade-1].grade > 1">
								<div class="form-control-static pull-left">
									单次消费满
								</div>
								<div class=" col-sm-4">
									<input type="number" min="0"  class="form-control" ng-model="posts.SINGLE_COST.special_value"/>
								</div>
								<div class="form-control-static pull-left">
									元，从
									<span class="text-red">一般顾客</span>
									升级到
									<span class="text-red" ng-bind="view.menber[view.show.grade-1].name"></span>
								</div>
							</div> -->

							<div class="form-group mb22"  ng-show="view.show.grade===1">
								<div class=" checkbox text-left">
									<label>
										<input type="checkbox" ng-model="posts.FREE" ng-checked="check.FREE"/>
										免费领卡
									</label>
								</div>
							</div>
						</div>
					</div>

					<div class="col-sm-10 col-sm-offset-2">
						<div class="row">
							<div class="col-sm-3">
								<a class="btn btn-default btn-block" back-button>返回</a>
							</div>
							<div class="col-sm-3 col-sm-offset-1">
								<button class="btn btn-danger btn-block" type="submit" ng-disabled="!add_form.$valid" disabled="disabled">确定</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<div class="col-sm-6 col-sm-offset-4  mt20"></div>
	<div class="col-sm-6 col-sm-offset-4 menberadd mt20">
		<div class="btn btn-danger" ng-click="switchStatus(true)">启用会员计划</div>
		<div class="col-sm-offset-2 btn btn-danger" ng-click="switchStatus(false)">停用会员计划</div>
	</div>
</div>
<div id="memberadd" class="modal fade addpanel" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<form name="planform">

			<div class="modal-content" style="overflow:hidden" >
				<div class="modal-header">
					<span  ng-bind="'设置'+(view.plan.level)+'级会员名称'"></span>
					<button type="button" class="close" data-dismiss="modal" ng-click="closeModal()">
						<span aria-hidden="true">×</span>
						<span class="sr-only">Close</span>
					</button>
					<h4 class="modal-title" id="mySmallModalLabel" ng-bind="modal.title"></h4>
				</div>
				<div class="modal-body" >
					<div class="form-horizontal" >
						<div class="form-group  mb0">
							<label class="col-sm-3 control-label">级别名称</label>
							<div class="col-sm-5">
								<input class="form-control" name="memberName" ng-model="tem.name" type="text" placeholder="输入该级别的名称"
								ng-minlength='2' ng-maxlength='10' ng-pattern="/[\u4e00-\u9fa5\d\w]/" required
								/>
							</div>
							<div class="help-block col-sm-4">
								<div class="" ng-show="!planform.memberName.$valid&&!planform.memberName.$touched">2-10个字符</div>
								<span ng-messages="planform.memberName.$error" ng-show="planform.memberName.$touched">
									<div class="text-red" ng-message="minlength">至少需要2个字符</div>
									<div  class="text-red" ng-message="maxlength">需小于10字符</div>
									<div class="text-red" ng-message="pattern">
										<span  ng-bind="config.textCheckErrorJson.nickname"></span>
									</div>
									<div class="text-red" ng-message="required">2-20字符的汉字英文数字</div>
								</span>
								<div class=" text-success" ng-show="planform.memberName.$valid">输入正确</div>
							</div>

						</div>
					</div>
				</div>
				<div class="modal-footer" >
					<div class="col-sm-3 col-sm-offset-6">
						<a class="btn btn-danger btn-block" ng-disabled="!planform.$valid" ng-click="handleClick(view.plan.level)">确定</a>
					</div>
					<div class="col-sm-3">
						<a data-dismiss="modal" class="btn btn-default btn-block" ng-click="closeModal()">关闭</a>
					</div>

				</div>
			</div>
		</form>
	</div>
</div>
